<?php

/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */

/**
 * Smarty email modifier plugin
 *
 * Type:     modifier
 * Name:     email
 * Purpose:  if url is present make link out of a string otherwise 
 * simply display the string.
 * Author:   Oleg Gashev
 * @param string
 * @return string
 *
 * Changelog:
 * 2007-03-30 version for email only.
 * 2007-01-18 PHP 4 support.
 * 2007-01-13 Added target param.
 * 2007-01-05 First release.
 */

function smarty_modifier_email($string) 
{
	// modify emails
	$string = preg_replace("`(\w+(?:[.-]\w+)* @ [-\w]+(?:\.\w[-\w]*)+)`ix", 
				"<a href=\"mailto:\$1\">\$1</a>", 
				$string);

	return $string;
}

?>
